package com.springcloud3.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * api分组设置
 */
@Configuration
public class ApiUiConfig {
    @Bean
    public GroupedOpenApi  helloApi()
    {
        return GroupedOpenApi.builder()
                .group("hello管理")
                .pathsToMatch("/hello/**","/hello/**")
                .build();
    }
    @Bean
    public GroupedOpenApi  loginApi()
    {
        return GroupedOpenApi.builder()
                .group("login管理")
                .pathsToMatch("/login/**","/login/**")
                .build();
    }
    @Bean
    public OpenAPI docOpenApi()
    {
        return new OpenAPI()
                .info(new Info().title("Springboots API")
                        .description("Springboots api")
                        .version("v0.0.1")
                        .license(new License().name("Apache 2.0").url("http://springdoc.org"))
                )
                .externalDocs(new ExternalDocumentation()
                        .description("Spring Cloud Documentation")
                        .url("https://springdoc.org"));
    }

}
